<?php 
define('IN_ADAGPS', TRUE);
include_once('cfg.php');
include_once(CORE_PATH.'includes/summary_functions.php');
include_once(CORE_PATH.'database/commonDB.php'); 
if(!ConnectDB()) {
    die('Không kết nối được  DATABASE');
}
//$date1 = time() - (24 * 60 * 60);
$date1 = time() ;
$date1=date('Y-m-d', $date1);
//$date1 ='2013-08-15';
$sql =" select id from tbl_service where active = 1";
$arrService = $objDbUpdate->GetArray($sql);
$countService = count($arrService);

//summary_product(3,$date1) ;
for($j=0;$j<$countService;$j++){
  $id = $arrService[$j]['id']; 
  summary_product($id,$date1) ; 
}
//fm_summary(3,$date1,$date1);
$svt_film = SVT_FILM; 
$sql =" select s.id from tbl_service as s join tbl_service_detail as d on s.id=d.service_id and d.service_type = $svt_film  where s.active = 1";
$arrfilm = $objDbUpdate->GetArray($sql);
$countFilm = count($arrfilm);
for($j=0;$j<$countFilm;$j++){
  $id = $arrfilm[$j]['id']; 
  fm_summary($id,$date1,$date1); 
} 
/*
$svt_cafe = SVT_CAFE; 
$sql =" select s.id from tbl_service as s join tbl_service_detail as d on s.id=d.service_id and d.service_type = $svt_cafe 
 where s.active = 1";
$arrfilm = $objDbUpdate->GetArray($sql);
for($j=0;$j<$count;$j++){
  $id = $arrService[$j]['id']; 
  cf_summary($id,$date1,$date1);  
}

 $svt_karaoke = SVT_KARAOKE; 
$sql =" select s.id from tbl_service as s join tbl_service_detail as d on s.id=d.service_id and d.service_type = $svt_karaoke  where s.active = 1";
$arrfilm = $objDbUpdate->GetArray($sql);
for($j=0;$j<$count;$j++){
  $id = $arrService[$j]['id']; 
  ka_summary($id,$date1,$date1);  
} 

$svt_bida = SVT_BIDA; 
$sql =" select s.id from tbl_service as s join tbl_service_detail as d on s.id=d.service_id and d.service_type = $svt_bida  where s.active = 1";
$arrfilm = $objDbUpdate->GetArray($sql);
for($j=0;$j<$count;$j++){
  $id = $arrService[$j]['id']; 
  bi_summary($id,$date1,$date1);  
} 

$svt_ms = SVT_MASSAGE; 
$sql =" select s.id from tbl_service as s join tbl_service_detail as d on s.id=d.service_id and d.service_type = $svt_ms  where s.active = 1";
$arrfilm = $objDbUpdate->GetArray($sql);
for($j=0;$j<$count;$j++){
  $id = $arrService[$j]['id']; 
  ms_summary($id,$date1,$date1);  
} 
$svt_ht = SVT_HOTEL; 
$sql =" select s.id from tbl_service as s join tbl_service_detail as d on s.id=d.service_id and d.service_type = $svt_ht  where s.active = 1";
$arrfilm = $objDbUpdate->GetArray($sql);
for($j=0;$j<$count;$j++){
  $id = $arrService[$j]['id']; 
  ms_summary($id,$date1,$date1);  
}  

   */

CloseDB();
?>
